//
//  OAUnDoneListCell.m
//  OASystem
//
//  Created by zhoupengfei on 15/3/26.
//  Copyright (c) 2015年 zpf. All rights reserved.
//

#import "OAUnDoneListCell.h"

@implementation OAUnDoneListCell

- (void)awakeFromNib {
    // Initialization
  
}
-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{


    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
     

        
    }
    return self;
}

+(instancetype)cellWithTableView:(UITableView*)tableView{
    static NSString * cellIdentifier = @"UnDoneCell";
    OAUnDoneListCell * cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    if (cell == nil) {
        cell  = [[[NSBundle mainBundle] loadNibNamed:@"OAUnDoneListCell" owner:nil options:nil] lastObject];
    }
 
    return cell;
}

-(void)setModel:(UnDoneModel *)model{
    _model = model;
    self.titleLabel.text = model.title;
    
    if (model.state.length  && model.name.length ) {
         self.desLabel.text = [NSString stringWithFormat:@"%@/%@/%@",model.time,model.state,model.name];
    }else if( model.state.length  &&  !model.name.length){
//        self.desLabel.text = [NSString stringWithFormat:@"%@",model.time];
           self.desLabel.text = [NSString stringWithFormat:@"%@/%@",model.time,model.state];

    }else if( !model.state.length &&  model.name.length ){
    
//        self.desLabel.text = [Nime];
           self.desLabel.text = [NSString stringWithFormat:@"%@/%@",model.time,model.name];

    }else if( !model.state.length && !model.name.length&&!model.time.length ){
     self.desLabel.hidden = YES;
//        self.desLabel.text = [Nime];
//           self.desLabel.text = [NSString stringWithFormat:@"%@/%@",model.time,model.name];

    }else{
       self.desLabel.text = [NSString stringWithFormat:@"%@",model.time];    }
    
    //icon 图片
    
    if([model.iconType isEqualToString:@"SendBox"]){
    
if ([self.model.isRead isEqualToString:@"1"]) {
             self.iconImageView.image = [UIImage imageNamed:@"邮件已读"];
        }else{
             self.iconImageView.image = [UIImage imageNamed:@"邮件"];

        }
        
    }else if ([model.iconType isEqualToString:@"InBox"]){
        if ([self.model.isRead isEqualToString:@"1"]) {
             self.iconImageView.image = [UIImage imageNamed:@"邮件已读"];
            
        }else{
             self.iconImageView.image = [UIImage imageNamed:@"邮件"];
// self.contentView.backgroundColor = [UIColor colorWithRed:231/255.0 green:231/255.0 blue:231/255.0 alpha:1];
        }
        
    }else{
     self.iconImageView.image = [UIImage imageNamed:@"fileicon"];
    }
   
}

@end
